﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimS7Study.Lib
{
    /// <summary>
    /// 错误字典
    /// </summary>
    public class ErrorDictionary
    {
        /// <summary>
        /// 附录六 （头错误字典）
        /// </summary>
        public static Dictionary<ushort, string> HeaderErrorDictionary = new Dictionary<ushort, string>()
        {
            { 0x0000,"无错误" },
            { 0x0110,"块号无效" },
            { 0x0112,"参数无效" },
            { 0x011A,"PG资源错误" },
            { 0x011B,"PLC资源错误" },
            { 0x011C,"协议错误" },
            { 0x011F,"结果缓冲区太小" },
            { 0x0141,"请求错误" },
            { 0x01C0,"版本不匹配" },
            { 0x01F0,"末实施" },
            { 0x8001,"当块处于当前状态时，无法执行请求的服务" },
           { 0x8500,"S7协议错误：帧错误" },
           { 0xD401,"信息功能不可用" },
           { 0xD402,"信息功能不可用" },
           { 0xD403,"服务已登录/注销（诊断/ PMC）" },
           { 0xD404,"达到的最大节点数。不再需要登录诊断/ PMC" },
           { 0xD405,"不支持服务或函数参数中的语法错误" },
           { 0xD406,"当前不可用的必需信息" },
           { 0xD601,"函数参数中的语法错误" },
           { 0xD801,"至少有一个标记地址无效" },
           { 0xD802,"指定的作业不存在" },
            { 0x8001,"当块处于当前状态时，无法执行请求的服务" },
           { 0xD803,"非法的工作状态" }

        };

        /// <summary>
        /// 附录十一 （data错误字典）
        /// </summary>
        public static Dictionary<ushort, string> DataErrorDictionary = new Dictionary<ushort, string>()
        {
            { 0xff,"成功"},
            { 0x00,"Reserved | 未定义，预留"},
            { 0x01,"硬件错误"},
            { 0x03,"对象不允许访问"},
            { 0x05,"地址越界，无效地址，所需的地址超出此PLC的极限"},
            { 0x06,"请求的数据类型与存储类型不一致"},
            { 0x07,"日期类型不一致"},
            { 0x0a,"对象不存在"}
        };

    }
}
